use api::api_convert;
use serde::{Deserialize, Serialize};

use crate::{client::Client, frame::{self, Frame}, AppErr, ErrConv};



pub async fn on_notify(frame: Frame) {

}

pub async fn on_request(frame: Frame, client: Client) {

}

pub async fn on_simple_request(frame: Frame, client: Client) {
    
}


#[derive(Debug, Deserialize)]
struct ReqInfo {
    name: String
}

#[derive(Debug, Serialize)]
struct ResInfo {
    code: u32,
}

#[api_convert]
async fn exec(info: ReqInfo) -> Result<ResInfo, AppErr> {

    todo!()
}

// async fn exec2(frame: Frame) -> Result<Box<[u8]>, AppErr> {
//     let info: ReqInfo = frame.parse_req()?;
//     let res = exec(info).await?;
//     let vec = serde_cbor::to_vec(&res).conv()?;
//     Ok(vec.into_boxed_slice())
// }


